#pragma once
#include <windows.h>
namespace Safe{
namespace Http
{

	/// <summary>
	/// Submits an HTTP POST request for a timestamp and returns the binary response.
	/// This class is used to submit timestamp requests to the trusted
	/// time server.
	/// </summary>
	public ref class HttpTimestampRequest { 

		private:
			array<unsigned char,1>^ m_request;

		public:
			/// <summary>Creates a new HTTP timestamp POST request</summary>
			/// <param name='pbRequest'>The ASN-encoded timestamp request</param>
			/// <param name='cbRequest'>The length of the pbRequest buffer</param>
			HttpTimestampRequest( BYTE *pbRequest, DWORD cbRequest );

			/// <summary>Creates a new HTTP timestamp POST request</summary>
			/// <param name='request'>The ASN-encoded timestamp request</param>
			HttpTimestampRequest( array<unsigned char>^ request );

			/// Destructor
			virtual ~HttpTimestampRequest();

			/// <summary>
			/// Submits the request to a trusted time server and retrieves the results
			/// This function may throw a System::Net::WebException if the request fails
			/// for any reason, such as the timestamp server being unreachable.
			/// </summary>
			/// <param name='url'>The URL of the timestamp server</param>
			/// <returns>The ASN-encoded timestamp response</returns>
			array<unsigned char>^ Submit(System::String^ url);
			
	};

	
}
}